package com.twfpro.httprequest;

import java.io.IOException;
import java.io.InputStream;

import okhttp3.Response;

/**
 * HTTP响应类
 * 
 * @author 高文
 *
 */
public class HttpRespone
{
	private Response respone;

	public HttpRespone(Response respone) throws IOException
	{
		this.respone = respone;
	}

	public int code()
	{
		return respone.code();
	}

	public String message()
	{
		return respone.message();
	}

	public String contentType()
	{
		return respone.body().contentType().toString();
	}

	public long contentLength()
	{
		return respone.body().contentLength();
	}

	public String header(String name)
	{
		return respone.header(name);
	}

	public InputStream byteStreamBody()
	{
		return respone.body().byteStream();
	}

	public byte[] byteArrayBody() throws IOException
	{
		return respone.body().bytes();
	}

	public String stringBody() throws IOException
	{
		return respone.body().string();
	}
}
